package com.tbit.uqbike.constant.enums;

import java.util.Objects;

/**
 * 同步配置枚举
 * @author <a href="mailto:liu.haoxiang@tbit.com.cn">BUGXiang</a>
 * @version 1.0
 * @since 2025-2-19
 */
public enum SynchronousConfigEnum {

    BILLINGRULES("计费规则", 1, "billingRulesService"),
    DEPOSIT("押金配置", 2, "depositService"),
    RECHARGECONFIGURATION("充值配置", 3, "rechargeConfigurationService"),
    MEMBERSHIPCARDCONFIG("会员卡配置",4, "membershipCardConfigService"),
    CYCLINGCARDCONFIG("骑行卡套餐配置", 5, "cyclingCardConfigService"),
    COUPONS("优惠券配置", 6, "couponsService"),
    PURCHASEINSTRUCTIONS("购买须知", 7, "purchaseInstructionsService"),
    SYSTEMCONFIG("系统配置", 8, "systemConfigService");



    private String name;
    private Integer code;
    private String className;


    SynchronousConfigEnum(String name, Integer code, String className) {
        this.name = name;
        this.code = code;
        this.className = className;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

    public String getClassName() {
        return className;
    }

    /**
     * 根据code 获取 所属service
     * @param code
     * @return
     */
    public static SynchronousConfigEnum getByCode(Integer code) {
        for (SynchronousConfigEnum value : SynchronousConfigEnum.values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }
}
